import { createRouter,createWebHashHistory } from "vue-router";
import  Home  from "@/views/Home/Home.vue";
export default createRouter({
  scrollBehavior:()=>{
    return{top:100}
  }
  ,
  history:createWebHashHistory(),
  routes:[{
    path:'/',
    component:()=>import('@/views/Layout/Layout.vue'),
    children:[
      {
        path: '' ,
        component:Home
      },
      {
        // 动态路由
        // category/123  ====> 
        // category/abcdd  ====> 
        path: 'category/:id', // 默认显示的内容
        component: () => import('@/views/Category/Category.vue')
      },
      {
        // 动态路由
        // category/123  ====> 
        // category/abcdd  ====> 
        path: 'product/:id', // 默认显示的内容
        component: () => import('@/views/Goods/Goods.vue')
      }
    ]
  },
  {
    path:'/login',
    component:()=>import('@/views/Login/Login.vue')
  }
]
})